package com.jiyun.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.jiyun.dto.StuRoomDto;
import com.jiyun.entity.StuRoom;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

/**
 * <p>
 *  Mapper 接口
 * </p>
 *
 * @author 聪哥哥
 * @since 2023-04-18
 */
public interface StuRoomMapper extends BaseMapper<StuRoom> {


    @Select("select \n" +
            "st.*,u.name sname,b.name bname,r.name as rname\n" +
            "from stu_room st,\n" +
            "28_kaoshi_sushe_login.user u,\n" +
            "28_kaoshi_sushe_base.building b,\n" +
            "28_kaoshi_sushe_base.room r \n" +
            "where st.sid=u.id and st.bid=b.id and st.rid=r.id and u.id =#{sid}")
    StuRoomDto findBySid(@Param("sid") Integer sid);
}
